/*!
\copyright  Copyright (c) 2017 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\version    Part of 6.3.0
\file       vncl3020.h
\brief      Header file for hy2571 Accelerometer
*/

#ifndef HY2751_PRIVATE_H
#define HY2751_PRIVATE_H

#ifdef HAVE_HY2751

#include <types.h>

/*! I2C communication addresses */

/*! @name VNCL3020 I2C registers. */
//!@{
//!@}

/*! Important note, this code assumes the compiler fills bitfields from the
    least significant bit, as KCC does, such that the following register
    bitfield definitions correctly map onto the physical bits */
#ifndef __KCC__
#warning "Not compiling with KCC. The bitfield register definitions may be incorrect."
#endif

/*! The 'on' PIO will not be controlled when __proximity_config.pio.on is set to
    this value */
#define HY2751_ON_PIO_UNUSED 255

#define HY2751_DETC_COUNT 5

/*! The high level configuration for taking measurement */
struct __proximity_config
{
    /*! Measurements higher than this value will result in the sensor considering
        it is in-proximity of an object */
        #if 0
    uint16 threshold_high;
    /*! Measurements lower than this value will result in the sensor considering
        it is not in-proximity of an object */
    uint16 threshold_low;
		
    /*! The I2C clock frequency */
    uint16 i2c_clock_khz;

    /*! The number of measurements above/below the threshold before the sensor
        generates an interrupt */
    enum vncl_threshold_counts threshold_counts;
    /*! The number of measurements per second */
    enum vncl3020_proximity_rates rate;
			#endif
    /*! The PIOs used to control/communicate with the sensor */
    struct
    {
        /*! PIO used to power-on the sensor, or #VNCL3020_ON_PIO_UNUSED */
        uint8 on;
        /*! Interrupt PIO driven by the sensor */
        uint8 interrupt;
    } pios;
};

/*! Internal representation of proximity state */
enum proximity_states
{
    proximity_state_unknown,
    proximity_state_in_proximity,
    proximity_state_not_in_proximity
};

/*! Trivial state for storing in-proximity state */
struct __proximity_state
{
    /*! The sensor proximity state */
    enum proximity_states proximity;
};

typedef enum
{
	LIGHT_SENSOR_VERIFY = 0x10,
};

#endif /* HAVE_HY2751 */
#endif /* VNCL3020_PRIVATE_H */
